﻿using System.Windows;
using Tdv.Wfrp.CharacterGenerator.Client.Views.Implementations;
using StructureMap;
using Tdv.Wfrp.CharacterGenerator.Client.IOC;
using Tdv.Wfrp.CharacterGenerator.Client.ViewModels.Interfaces;
using Tdv.Wfrp.CharacterGenerator.Client.Bootstrapper;
using System.Collections.ObjectModel;
using StructureMap.Configuration.DSL;

namespace Tdv.Wfrp.CharacterGenerator.Client
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        private void OnStartup(object sender, StartupEventArgs e)
        {
            CreateIOCContainer();
            // Create the ViewModel and expose it using the View's DataContext
            MainView view = Services.ServiceProvider.GetService<MainView>();
            view.DataContext = Services.ServiceProvider.GetService<IMainViewModel>();
            view.Show();
        }

        private void CreateIOCContainer()
        {
            Bootstrapper.BootstrapFactory.Bootstrap(new Collection<Registry> { new CharacterGeneratorClientRegistry() });
        }

        
    }
}
